Skip to content

feat: Add pipecat integration - #543

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi-pipecat-integration
Aug 5, 2026
Merged

feat: Add pipecat integration#543
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi-pipecat-integration

Conversation

@AbhiPrasad

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Jul 3, 2026

Copy link
Copy Markdown
Member

resolves https://linear.app/braintrustdata/issue/SDK-7/braintrust-pipecat-integration
resolves #550

AI Summary

Adds observer-based Pipecat instrumentation through setup_pipecat() and auto_instrument(). The integration injects a BraintrustPipecatObserver into PipelineWorker construction and turns pipeline, model, tool, transcription, and speech events into Braintrust spans.

The integration supports Pipecat AI 1.3.0 and the pinned latest version, with versioned VCR coverage and subprocess coverage for auto-instrumentation.

Usage

import braintrust

braintrust.init_logger(project="pipecat-demo")
braintrust.auto_instrument()

Manual setup and audio options are also available:

from braintrust.integrations.pipecat import setup_pipecat

setup_pipecat(
    capture_user_audio_attachments=True,
    capture_agent_audio_attachments=False,
)

The existing aggregate option remains supported:

setup_pipecat(capture_audio_attachments=True)

Audio attachment controls

Audio attachments can be controlled across integrations with generic environment variables:

BRAINTRUST_CAPTURE_USER_AUDIO_ATTACHMENTS=true
BRAINTRUST_CAPTURE_AGENT_AUDIO_ATTACHMENTS=false

For Pipecat, precedence is:

  1. capture_user_audio_attachments / capture_agent_audio_attachments
  2. capture_audio_attachments
  3. The corresponding environment variable
  4. The integration default
Integration Attachment location Default
Pipecat user audio user_speakinginput.audio disabled
Pipecat agent/TTS audio tts_responseoutput.audio disabled
LiveKit agent playback audio agent_speakingoutput.audio enabled for backward compatibility

Setting BRAINTRUST_CAPTURE_AGENT_AUDIO_ATTACHMENTS=false disables LiveKit playback attachments while preserving agent_speaking spans and transcripts.

Captured PCM chunks are accumulated and logged as WAV/PCM Braintrust attachments with sample-rate, channel-count, frame-count, and byte-size metadata when available.

Validation

Coverage includes:

  • Pipecat latest and 1.3.0 integration sessions
  • LiveKit Agents latest and 1.3.1 audio-control coverage
  • shared environment and integration utility tests
  • pre-commit formatting, lint, and cassette-hygiene checks

Co-authored by StarfolkAI (@starfolkai)[bot]

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-pipecat-integration branch 5 times, most recently from 0646781 to 2908880 Compare July 7, 2026 23:09
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-pipecat-integration branch 2 times, most recently from e80c676 to 4e57906 Compare August 4, 2026 20:26
Instrument Pipecat PipelineWorker instances through setup_pipecat() and
auto_instrument(), emitting observer-based pipeline, model, tool,
transcription, and speech spans. Cover the latest and minimum supported
Pipecat versions with versioned VCR tests.

Support independent user and agent audio attachments through the
capture_user_audio_attachments, capture_agent_audio_attachments, and
aggregate capture_audio_attachments options. Add matching generic
BRAINTRUST_CAPTURE_USER_AUDIO_ATTACHMENTS and
BRAINTRUST_CAPTURE_AGENT_AUDIO_ATTACHMENTS environment variables. Pipecat
keeps attachments off by default; LiveKit preserves its existing agent-audio
default while allowing the generic variable to disable it.
@lforst

Copy link
Copy Markdown
Member

dam u doing the stacked prs thing

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 1bd10db into main Aug 5, 2026
82 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi-pipecat-integration branch August 5, 2026 14:09
Abhijeet Prasad (AbhiPrasad) added a commit that referenced this pull request Aug 5, 2026
## Summary

- disable LiveKit agent playback audio attachments by default
- allow users to opt in with
`BRAINTRUST_CAPTURE_AGENT_AUDIO_ATTACHMENTS=true`
- preserve `agent_speaking` spans and synchronized transcripts when
attachments are disabled
- update the LiveKit setup documentation and regression coverage

This PR is stacked on #543, which introduces the generic audio
attachment environment controls.

## Validation

- `nox -s "test_livekit_agents(latest)" -- -k
"agent_audio_capture_respects_generic_env or agent_speaking_e2e"`
- `nox -s "test_livekit_agents(1.3.1)" -- -k
"agent_audio_capture_respects_generic_env"`
- pre-commit checks on the changed files
- pylint on the changed files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] Add Pipecat (pipecat-ai) integration for Pipeline execution and LLM service frame instrumentation

2 participants